"""
進入爱逛卖家版
"""
import time

import yaml
from uiautomator2 import xpath


from page_object.guang_page import GuangPage
from resource.path_info import *

"""
直播推广
"""
class BroadCastPromotionPage(GuangPage):


    def check_broadcast_cast(self, d):
        print("check_broadcast_cast")
        d.xpath(broadcast_promotion_card_xpath).wait(timeout=5.0)
        if d.xpath(broadcast_promotion_card_xpath).exists:
            print("check_broadcast_cast successfully")
        else:
            raise Exception("check_broadcast_cast fail")
        return self

    """
    分享微信
    """
    def share_broadcast_cast_wechat(self, d):
        print("share_broadcast_cast_wechat")
        d.xpath(share_wechat_icon_xpath).click()
        d.xpath(wechat_group_head_xpath).wait(timeout=5.0)
        d.xpath(wechat_group_head_xpath).click()
        d.xpath(wechat_send_confirm_xpath).click()
        d.xpath(wechat_sent_back_xpath).click()
        return self

    """
    下载海报
    """
    def download_broadcast_cast(self, d):
        print("download_broadcast_cast")
        d.xpath(download_card_xpath).click()
        time.sleep(2)
        d.press("back")
        return self
    """
    分享朋友圈
    """

    def share_broadcast_wechat_list(self, d):
        print("share_broadcast_wechat_list")
        d.xpath(share_wechat_list_icon_xpath).click()
        d.xpath(wechat_list_send_xpath).wait(timeout=5.0)
        d.xpath(wechat_list_send_xpath).click()
        return self

